<template>
  <div class="search-music-right-anchor">
    <div class="wrap">
      <div class="header">
        <div class="header-title">热门主播</div>
      </div>
      <div class="main">
        <template v-for="item in anchors" :key="item">
          <anchor-card
            :src="item.avatarUrl"
            :name="item.nickName"
            :intrudce="item.mainAuthDesc"
          />
        </template>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, onMounted, computed } from 'vue'
import { useStore } from 'vuex'

import AnchorCard from './anchor-card.vue'

export default defineComponent({
  components: {
    AnchorCard
  },
  setup() {
    const store = useStore()
    onMounted(() => {
      store.dispatch('searchMusic/getHotAnchor')
    })
    const anchors = computed(() => store.state.searchMusic.hotestAnchor)
    return {
      anchors
    }
  }
})
</script>

<style scoped lang="less">
.search-music-right-anchor {
  width: 100%;
  .wrap {
    margin: auto;
    width: 90%;
    height: 95%;
    padding: 10px;
    .header {
      font-size: 10px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding-bottom: 5px;
      margin-bottom: 10px;
      border-bottom: 1px solid #ccc;
      .header-title {
        color: #333;
        font-weight: 600;
        transform: scale(0.9);
      }
    }
    .main {
      width: 100%;
    }
  }
}
</style>
